package DAO;

import org.hibernate.Session;
import org.hibernate.SessionFactory;

import Beans.PlatoBean;
import HibernateUtils.HibernateUtil;

public class HibernatePlatoDAO {
	

	private static HibernatePlatoDAO instancia;
	private static SessionFactory sf;

	public static HibernatePlatoDAO getInstancia(){
		if(instancia==null){
			sf=HibernateUtil.getSessionFactory();
			instancia=new HibernatePlatoDAO();
		}
		return instancia;
	}


	public PlatoBean getPlato(int id){
		Session session=sf.openSession();

		PlatoBean plato=(PlatoBean)	session.get(PlatoBean.class, id);
		session.close();
		return plato;

	}


}
